package permission

import (
	"net/http"

	"private-domain-overseas-service/admin/business/api/internal/logic/permission"
	"private-domain-overseas-service/admin/business/api/internal/svc"
	"private-domain-overseas-service/admin/business/api/internal/types"

	"github.com/zeromicro/go-zero/rest/httpx"
	"private-domain-overseas-service/pkg/result"
)

// 后台角色查询接口
func AdminRoleListHandler(svcCtx *svc.ServiceContext) http.HandlerFunc {
	return func(w http.ResponseWriter, r *http.Request) {
		var req types.AdminRoleListRequest
		if err := httpx.Parse(r, &req); err != nil {
			result.HttpErrorResult(r, w, err)
			return
		}

		l := permission.NewAdminRoleListLogic(r.Context(), svcCtx)
		resp, err := l.AdminRoleList(&req)

		result.HttpResult(r, w, resp, err)
	}
}
